<template>
    <el-select v-model="va" placeholder="请选择">
    <el-option
      v-for="item in list"
      :key="item.stu_id"
      :label="item.name"
      :value="item.stu_id">
    </el-option>
  </el-select>
</template>

<script>
export default {
    name:"stuSelector",
    model:{
        prop:"val",
        event:"change"
    },
    props:{
        val:{
            default(){
                return ""
            }
        }
    },
    data(){
        return{
            list:[],
            va:""
        }
    },
    methods:{
        getstu(){
            let that = this
            this.axios
            .get("/opt/student",{})
            .then(res=>{
                console.log(res);
                that.list = res.data.data
            })
        }
    },
    mounted(){
        this.getstu()
        console.log(this.val);
    }
}
</script>

<style>

</style>